<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
  <title>活力山泉小程序</title>
  <style>
    body.gray-bg {
      background: #f9f9f9;
      height: 100vh;
    }

  </style>
</head>

<body>
  <div id="app"></div>
  <!-- built files will be auto injected -->
  <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  <script>
    var getWxParams = function (name) {
      var ps = {};
      var ts = location.search.split(/[\?|&]/g);
      for (var i in ts) {
        var a = ts[i];
        if (!a) continue;
        var ss = a.split('=');
        ps[ss[0]] = decodeURIComponent(ss[1]);
      }
      return ps[name];
    }

    // 传递过来的用户信息
    var uid = getWxParams('uid');
    var invite_code = getWxParams('invite_code');
    localStorage.setItem('uid', uid)
    localStorage.setItem('invite_code', invite_code)

    // 支付成功回调
    var payType = getWxParams('payType');
    if (payType) {
      localStorage.setItem('payType', payType)
    }

    // 传递城市参数
    var city = getWxParams('city');
    if (city) {
      localStorage.setItem('city', city)
    }

    // 邀请用户参数
    var inType = getWxParams('inType');
    if (inType) {
      localStorage.setItem('inType', inType)
    }

    // 传递使用水票参数
    var productId = getWxParams('productId');
    var useTicketNumber = getWxParams('useTicketNumber');
    var isuseTicket = getWxParams('isuseTicket');
    if (productId && useTicketNumber && isuseTicket) {
      localStorage.setItem('isuseTicket', isuseTicket)
      localStorage.setItem('productId', productId)
      localStorage.setItem('useTicketNumber', useTicketNumber)
    }

    // 申请入股
    var applyType = getWxParams('applyType')
    var shareCode = getWxParams('share_code')

    if (applyType == 'applyType') {
      localStorage.setItem('applyType', applyType)
      if (shareCode) {
        localStorage.setItem('shareCode', shareCode)
      }
    }
  </script>
</body>

</html>
